package com.bawei.day11_contentprovider;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;

import java.util.List;

/***
 * 工具类：获得手机里所有的音乐
 */
public class MainActivity extends AppCompatActivity {
    private ImageView imageView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
            requestPermissions(new String[]{
                    "android.permission.WRITE_EXTERNAL_STORAGE",
                    "android.permission.READ_EXTERNAL_STORAGE",
                    "android.permission.READ_CONTACTS",
                    "android.permission.READ_SMS",
                    "android.permission.CALL_PHONE"

            },101);
        }
        List<SongBean> songs = SongsUtils.getInstance(this).getSongs();
        Log.d("ytx", "onCreate: "+songs);
        imageView = findViewById(R.id.iv);

        Glide.with(this)
                .load(songs.get(0).getAlbum())
                .transform(new CircleCrop())//圆形图片
                .into(imageView);


    }

}
